package com.autotest.nore.mapper;

import com.autotest.nore.domain.CaseApi;
import com.autotest.nore.dto.ApiCaseDTO;
import com.autotest.nore.dto.CaseApiDTO;
import com.autotest.nore.dto.CaseApiListDTO;
import com.autotest.nore.dto.CaseApiReportDTO;
import com.autotest.nore.request.QueryRequest;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CaseApiMapper {
    void addCaseApi(List<CaseApi> caseApis);

    void deleteCaseApi(String caseId);

    void deleteById(String id);

    List<CaseApiDTO> getCaseApiList(String caseId);

    List<ApiCaseDTO> getCaseApiIndex(String caseId);

    ApiCaseDTO getCaseApiDetailByCaseApiId(String caseApiId);

    List<ApiCaseDTO> getCaseApiListByApi(String apiId);

    List<ApiCaseDTO> getCaseApiList2(QueryRequest request);

    List<ApiCaseDTO> getApiCaseListByCaseId(String caseId);

    @Select("SELECT id,name FROM case_api WHERE api_id = #{apiId}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "caseApiName", column = "name")
    })
    List<CaseApiListDTO> getCaseApisByApiId(@Param("apiId") String apiId);

    void saveCaseApi(ApiCaseDTO apiCaseDTO);

    void updateCaseApi(ApiCaseDTO apiCaseDTO);

    List<CaseApiReportDTO> caseApiReport(String projectId,String condition,Boolean existsInCaseApiIndex);

    ApiCaseDTO getCaseApiById(String id);

    List<CaseApi> findByApiId(@Param("apiId") String apiId);
}